import { BrowserRouter,Route,Switch,Redirect } from 'react-router-dom';
import { lazy,Suspense } from 'react';
import Header from './pages/Header/Header';
import Faxianmusic from './components/Faxianmusic/Faxianmusic';
import Footer from './pages/Footer/Footer';
import Play from './pages/Play/Play';
import './App.css';
const Tuijiangedan = lazy(() => import('./components/Tuijiangedan/Tuijiangedan'));
const Zuixinmv = lazy(() => import('./components/Zuixinmv/Zuixinmv'));
const Zuixinsong = lazy(() => import('./components/Zuixinsong/Zuixinsong'));
const SearchList = lazy(() => import('./components/SearchList/SearchList'));
const Remengeshou = lazy(() => import('./components/Remengeshou/Remengeshou'));
const Paihang = lazy(() => import('./components/Paihang/Paihang'));
const GedanDetail = lazy(() => import('./components/GedanDetail/GedanDetail'));
const MvDetail = lazy(() => import('./components/MvDetail/MvDetail'));
function App() {
  return (
    <BrowserRouter>
    <div id="App">
      <Header></Header>
      <Switch>
         <Suspense fallback={()=>{return (<Faxianmusic></Faxianmusic>)}}>
            <Route path='/faxianmusic' component={Faxianmusic}></Route>
            <Route path='/tuijiangedan' component={Tuijiangedan}></Route>
            <Route path='/zuixinmv' component={Zuixinmv}></Route>
            <Route path='/zuixinsong' component={Zuixinsong}></Route>
            <Route path='/search'  render={(route)=>{return (<SearchList key={route.location.search.split('=')[1]} props={route}></SearchList> )}}></Route>
            <Route path='/remengeshou' component={Remengeshou}></Route>
            <Route path='/paihang' component={Paihang}></Route>
            <Route path='/gedandetail' component={GedanDetail}></Route>
            <Route render={(route)=>{return (<MvDetail key={route.location.search.split('=')[1]} props={route}></MvDetail> )}} path='/mvdetail'></Route>
            <Redirect to='/faxianmusic'></Redirect>
         </Suspense>
      </Switch>
      <Footer></Footer>
      <Play></Play>
    </div>
    </BrowserRouter>
  );
}

export default App;
